# @author: uuz
# encoding = utf-8

from ext import db


class Room(db.Model):
    __tablename__ = "room"
    id = db.Column(db.Integer, nullable=False, primary_key=True, autoincrement=True)
    hotel_id = db.Column(db.Integer, db.ForeignKey("hotel.id"))
    price = db.Column(db.Integer, nullable=False, default=0)
    type = db.Column(db.String(10), nullable=False, default="")
    subtype = db.Column(db.String(20), nullable=False, default="")
    area = db.Column(db.Integer, nullable=False, default=0)
    bedtype = db.Column(db.Integer, nullable=False, default=1)
    windowtype = db.Column(db.Integer, nullable=False, default=1)
    breakfast = db.Column(db.Boolean, nullable=False, default=False)
    cancelable = db.Column(db.Boolean, nullable=False, default=False)
    remains = db.Column(db.Integer, nullable=False, default=5)

    orders = db.relationship("Order", foreign_keys="Order.room_id", backref="room")